package vn.qnamuni.calendar.alarm;

import java.util.Calendar;

import android.util.Log;

public class Date {
	private int Year;
	private int Month;
	private int Day;
	private int Hour;
	private int Minute;
	private int Second;

//	private boolean isOver(int mon, int day) {
//		if (mon < 1 + Calendar.getInstance().get(Calendar.MONTH)) {
//			return true;
//		}
//		if (day < Calendar.getInstance().get(Calendar.DATE)) {
//			return true;
//		}
//		return false;
//	}

	public Date(String date, String time) {
		try {
			String[] d = date.split("-");
			Month = Integer.parseInt(d[0].trim());
			Day = Integer.parseInt(d[1].trim());
			Year = Integer.parseInt(d[2].trim());

//			if (isOver(Month, Day)) {
//				Year = Calendar.getInstance().get(Calendar.YEAR) + 1;
//				Log.v("Date", "un" + Year);
//			} else {
//				Year = Calendar.getInstance().get(Calendar.YEAR);
//				Log.v("Date", "same" + Year);
//			}

			// time
			if (null != time) {
				String[] t = time.split(":");
				Hour = Integer.parseInt(t[0]);
				Minute = Integer.parseInt(t[1]);
				Second = Integer.parseInt(t[2]);
			}
		} catch (Exception e) {
			Log.v("Date Exception", e.getMessage());
		}
	}

	
	public int getInfo(int con) {
		switch (con) {
		case Calendar.YEAR:
			return Year;
		case Calendar.MONTH:
			return Month;
		case Calendar.DATE:
			return Day;
		case Calendar.HOUR:
			return Hour;
		case Calendar.MINUTE:
			return Minute;
		case Calendar.SECOND:
			return Second;
		default:
			return 0;
		}
	}
}
